package com.example.wzsdk.attention;

import android.util.Log;

import com.example.wzsdk.constant.Data;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by SunLight on 2017/8/14.
 */

public class Equipment {
    static List<String[]> list = new ArrayList<>();
    static Data data;

    /***
     * 设备名
     * */
    public String Name(String uiid) {
        switch (uiid) {
            case "30008":
                return "温湿度";
            case "30019":
                return "心率";
            case "30018":
                return "颜色识别";
            case "30010":
                return "可燃气体";
            case "30009":
                return "光敏";
            case "30011":
                return "人体红外";
            case "30014":
                return "门禁";
            case "30012":
                return "风扇";
            case "30016":
                return "报警";
            case "30015":
                return "电灯";
            case "30013":
                return "RFID";
            case "30017":
                return "指纹识别";
        }
        return null;
    }

    /**
     * 初始化设备列表
     */
    public void Management(Data data) {
        if (data != null) {
            this.data = data;
            list.clear();

            for (int i = 0; i < data.Node.size(); i++) {
                Log.e("xzvwefzscz", Arrays.toString(data.Node.get(i)));
                if (data.Node.get(i)[1].equals("30008")) {
                    if (data.Node.get(i)[2].equals("1")) {
                        list.add(new String[]{"Name:" + "温度", "Uiid:" + data.Node.get(i)[1], "下标:" + data.Node.get(i)[2], "变量id:" + data.Node.get(i)[3], "设备id:" + data.Node.get(i)[5], "设备状态:" + data.Node.get(i)[4], "绑定id:" + data.Node.get(i)[0]});
                    } else if (data.Node.get(i)[2].equals("2")) {
                        list.add(new String[]{"Name:" + "湿度", "Uiid:" + data.Node.get(i)[1], "下标:" + data.Node.get(i)[2], "变量id:" + data.Node.get(i)[3], "设备id:" + data.Node.get(i)[5], "设备状态:" + data.Node.get(i)[4], "绑定id:" + data.Node.get(i)[0]});
                    }
                } else {
                    if (data.Node.get(i)[2].equals("1")) {
                        list.add(new String[]{"Name:" + Name(data.Node.get(i)[1]), "Uiid:" + data.Node.get(i)[1], "下标:" + data.Node.get(i)[2], "变量id:" + data.Node.get(i)[3], "设备id:" + data.Node.get(i)[5], "设备状态:" + data.Node.get(i)[4], "绑定id:" + data.Node.get(i)[0]});
                    }
                }
            }
        }
    }

    /**
     * 返回设备列表
     */
    public List<String[]> getDateList() {
        return list;

    }
}

